#ifndef HTTP_SERVER_H
#define HTTP_SERVER_H

#include "http_.h"
#include <winsock2.h>

// 服务器配置
#define SERVER_PORT 12345
#define MAX_CLIENTS 10
#define BUFFER_SIZE 4096

// HTTP服务器结构
typedef struct {
    SOCKET listen_socket;
    SOCKET client_sockets[MAX_CLIENTS];
    int client_count;
    fd_set read_fds;
} http_server_t;

// 初始化HTTP服务器
int http_server_init(http_server_t *server);

// 运行HTTP服务器
void http_server_run(http_server_t *server);

// 清理HTTP服务器
void http_server_cleanup(http_server_t *server);

// 处理HTTP请求
void handle_http_request(SOCKET client_socket, const char *request, size_t length);
// 添加文件处理函数声明
void handle_file_download(SOCKET client_socket, const char *path);
void handle_file_upload(SOCKET client_socket, const http_message_t *request);
void handle_file_list(SOCKET client_socket);
#endif // HTTP_SERVER_H